package com.hand.wfive.fragment.sign

import android.os.Bundle
import com.bumptech.glide.Glide
import com.hand.wfive.R
import com.hand.wfive.base.BaseFragment
import com.hand.wfive.entity.Params
import com.hand.wfive.view.WatermarkTransformation
import com.qmuiteam.qmui.util.QMUIDisplayHelper
import kotlinx.android.synthetic.main.fragment_sign_preview_item.photo_view

class SignPreviewItemFragment : BaseFragment() {

    companion object {
        fun load(path: String): BaseFragment {
            val fragment = SignPreviewItemFragment()
            fragment.arguments = Bundle()
            fragment.arguments?.putString(Params.path, path)
            return fragment
        }
    }

    override fun getLayoutId() = R.layout.fragment_sign_preview_item

    override fun initKotlinWidget() {
        val path = arguments?.getString(Params.path)
        if (path.isNullOrEmpty()) return
        Glide.with(mContext).asBitmap().load(path).transform(WatermarkTransformation())
            .override(QMUIDisplayHelper.getScreenHeight(mContext))
            .into(photo_view)
    }
}